#include<iostream>
using namespace std;
int main()
{
	int n;	//long long
	cin >> n;
	cout << n % 7;
	return 0;
}